package com.kymatrix.kycarbon.xsmd.system.server.outer;

import cn.hutool.core.lang.Dict;
import com.kymatrix.kycarbon.xsmd.system.server.model.entity.UserEntity;
import com.kymatrix.kycarbon.xsmd.system.api.dto.UserDto;
import com.kymatrix.kycarbon.xsmd.system.api.service.UserApi;
import com.kymatrix.kycarbon.xsmd.system.server.dao.UserMapper;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author liujie
 * @date 2024-04-22
 */
@Component
@Slf4j
public class UserApiImpl implements UserApi {
    
    @Resource
    private UserMapper userMapper;
    
    @Override
    public UserDto getUser(String id) {
        UserEntity userEntity = userMapper.selectById(id);
        return userEntity.toDto();
    }

    @Override
    public List<UserDto> getUserList(Collection<String> ids) {
        List<UserEntity> userEntities = userMapper.selectBatchIds(ids);
        List<UserDto> userList = new ArrayList<>();
        for (UserEntity userEntity : userEntities) {
            userList.add(userEntity.toDto());
        }
        return userList;
    }

    @Override
    public List<UserDto> getUserListByDeptIds(Collection<String> deptIds) {
        return Collections.emptyList();
    }

    @Override
    public List<UserDto> getUserListByPostIds(Collection<String> postIds) {
        return Collections.emptyList();
    }

    @Override
    public void validateUserList(Collection<String> ids) {

    }

    @Override
    public Dict findById(Long aLong) {
        return null;
    }

    @Override
    public List<Dict> selectUserListByRoleCode(String group) {
        return null;
    }
}
